Locking down Attr (help needed)

Hello,

I am attempting to limit access at the attribute level the basic Idea is to lock V&V out of Eng attr and Eng out of V&V attr and all other attr to inhert at the module level. Below is the my code I was wondering if my logic is correct and was wondering why on some modules I'm getting the error message of "rights are inheritedAccess". This is my first attempt of locking down attributes at this level typical I manage access at the module level but I am being ask to limit access even further. Thank you.

Regards,
Jim
 

pragma runLim, 0
 
Skip EngAttrList = create()
Skip IVVAttrList = create()
Skip EngUserGroup = create()
Skip IVVUserGroup = create()
 
//Engineering Attributes
put(EngAttrList, "Object Text", "Object Text")
put(EngAttrList, "Object Short Text", "Object Short Text")
put(EngAttrList, "Object Heading", "Object Heading")
put(EngAttrList, "_1E Req", "_1E Req")
put(EngAttrList, "_Comments", "_Comments")
put(EngAttrList, "_Criticality", "_Criticality")
put(EngAttrList, "_Level 2 Req", "_Level 2 Req")
put(EngAttrList, "_NC Req", "_NC Req")
put(EngAttrList, "_NC+ Req", "_NC+ Req")
put(EngAttrList, "_Remarks", "_Remarks")
put(EngAttrList, "_Req Eval", "_Req Eval")
put(EngAttrList, "_Req Type", "_Req Type")
//Engineering UserGroup
put(EngUserGroup, "Engineering Lead", "Engineering Lead")
put(EngUserGroup, "Application Engineer", "Application Engineer")
put(EngUserGroup, "Hardware Engineer", "Hardware Engineer")
put(EngUserGroup, "CNCS Engineer", "CNCS Engineer")
put(EngUserGroup, "1E Engineer", "1E Engineer")
 
//IV&V Attributes
put(IVVAttrList, "_IV&V ASW Req", "_IV&V ASW Req")
put(IVVAttrList, "_IV&V Comments", "_IV&V Comments")
put(IVVAttrList, "_IV&V Feasible", "_IV&V Feasible")
put(IVVAttrList, "_IV&V Remarks", "_IV&V Remarks")
put(IVVAttrList, "_IV&V Testable", "_IV&V Testable")
//IV&V UserGroup
put(IVVUserGroup, "IV&V Lead", "IV&V Lead")
put(IVVUserGroup, "IV&V Engineer", "IV&V Engineer")
 
/**********************************
    unsetAllDefVal
***********************************/
void unsetAllDefVal(Module m, Skip List1)
{
        string attr = null
        string err = null
        AttrDef ad
        
        for attr in List1 do 
        {
                ad = find(m, attr)
 
                if(!null ad)
                {
                        err = unsetAllDef(m, ad)
                                if (!null err) print err
                        err = unsetAllVal(m, ad)
                                if (!null err) print err
                }
        }
}
 
/**********************************
        setAttrDefVal
***********************************/
void setAttrDefVal(Module m, Skip List1, Skip List2)
{
        string attr = null
        string err = null
        string usergroup = null
        AttrDef ad
        
        for attr in List1 do 
        {
                ad = find(m, attr)
                
                if(!null ad)
                {
                        usergroup = null
                        
                        for usergroup in List2 do 
                        {
                                err = setDef(m, ad, read, usergroup)
                                        if (!null err) print err
                                err = setVal(m, ad, read|modify, usergroup)
                                        if (!null err) print err
                        }
                }
        }
}
 
/**********************************
        scanModule
***********************************/
void scanModule(Item itm)
{
        Module thisModule = null
 
        string mName = fullName(itm)
 
        thisModule = edit(mName, false,true)
        
        if (!null thisModule)
        {
                unsetAllDefVal(thisModule, EngAttrList)
                unsetAllDefVal(thisModule, IVVAttrList)
                                
                setAttrDefVal(thisModule, EngAttrList, EngUserGroup)
                setAttrDefVal(thisModule, IVVAttrList, IVVUserGroup)
        }
 
        if (!null thisModule)
        {
                save(thisModule)
                close(thisModule)
        }
}
 
/*********************************
        scanFolder
**********************************/
void scanFolder(Folder f)
{
        Item itm
 
        for itm in f do
        {
                if (null itm) continue
                if (isDeleted(itm)) continue
 
                if ((type (itm) == "Project") || (type (itm) == "Folder"))
                {
                        scanFolder(folder(itm))
                }
                else if (type (itm) == "Formal")
                {
                        scanModule(itm)
                }
        }
}
 
/************************************
        MAIN
*************************************/
string currFolder = fullName current Folder
 
if (confirm("Lock[Attr] for " currFolder "?"))
{
        scanFolder(folder currFolder)
        
        delete EngAttrList
        delete IVVAttrList
        delete EngUserGroup
        delete IVVUserGroup
        
        // notify the user that the script is complete
        ack "Complete."
}

SystemAdmin - Fri May 04 10:24:53 EDT 2012

Re: Locking down Attr (help needed)
llandale - Sat May 05 16:51:50 EDT 2012

[] First off, if a Skip list's "Key" is type "string" then you MUST use "createString" instead of "create". Since all 4 use names as key you need to change those 4 statements.
[] The "delete(skp) commands should unconditionally after the "if" statement, not inside it.
[] I don't think you can "unset" unless the access is already "specific" (not "inherited"), so you'll need in the first function:
  • err = specificDef(m, ad)
  • err = specificVal(m, ad)

Otherwise, I didn't see anything wrong with the logic but something doesn't quite feel right .. with what you are trying to accomplish.

-Louie

Re: Locking down Attr (help needed)
SystemAdmin - Sat May 05 21:11:45 EDT 2012

llandale - Sat May 05 16:51:50 EDT 2012
[] First off, if a Skip list's "Key" is type "string" then you MUST use "createString" instead of "create". Since all 4 use names as key you need to change those 4 statements.
[] The "delete(skp) commands should unconditionally after the "if" statement, not inside it.
[] I don't think you can "unset" unless the access is already "specific" (not "inherited"), so you'll need in the first function:

  • err = specificDef(m, ad)
  • err = specificVal(m, ad)

Otherwise, I didn't see anything wrong with the logic but something doesn't quite feel right .. with what you are trying to accomplish.

-Louie

"but something doesn't quite feel right .. with what you are trying to accomplish." just wondering what you see wrong with locking down the attributes. Currently I have the modules locked down with (RM) for V&V but under this method V&V engineers have modified engineering attribute my mistake.

-Jim

Re: Locking down Attr (help needed)
llandale - Mon May 07 12:02:10 EDT 2012

SystemAdmin - Sat May 05 21:11:45 EDT 2012
"but something doesn't quite feel right .. with what you are trying to accomplish." just wondering what you see wrong with locking down the attributes. Currently I have the modules locked down with (RM) for V&V but under this method V&V engineers have modified engineering attribute my mistake.

-Jim

OK, this is nebulous intuitive opinion.

I think you are mixing paradigms; a group-centrix approach for some attributes and an attribute-centrix approach for the others. This is no disaster but it makes future modifications somewhat awkward. I think you should choose one of these:
[1] For each attribute, which groups are allowed to modify values.
1a For each attribute assign it multi-enum "types"; then for each type assign Groups
... Types may be "Engineer" attribute, "IVV", "BookBoss" etc.
[2] For each Group, which attributes they are allowed to modify.

-Louie